﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Grain.Crm.DataMigrator.CrmServices;
using Grain.Crm.DataMigrator.Imports.EntityImports;

namespace Grain.Crm.DataMigrator.Imports
{
    public class ImportFactory
    {
        public static ImportBase Create(CrmService service, WhoAmIResponse whoAmIResponse, ImportPayload payload)
        {
            if (payload.EntityName == EntityName.contact.ToString())
                return new ContactImport(service, whoAmIResponse, payload);

            if (payload.EntityName == EntityName.new_curriculumvitae.ToString())
                return new CvImport(service, whoAmIResponse, payload);

            if (payload.EntityName == EntityName.new_contactlanguage.ToString())
                return new ContactLanguageImport(service, whoAmIResponse, payload);
            
            if (payload.EntityName == EntityName.new_contactskill.ToString())
                return new ContactSkillImport(service, whoAmIResponse, payload);
            
            throw new InvalidOperationException("Import factory creation not supported");
        }
    }
}
